﻿namespace WebOptimizer.UI.Entities.Model
{
	public class ResourceManager : global::WebOptimizer.Data.Model.IResourceManager
	{
		#region CreateItem

		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
		public global::WebOptimizer.UI.Entities.Source CreateSource(Sidvall.Data.DataRowState? dataRowState)
		{
			return new global::WebOptimizer.UI.Entities.Source(dataRowState);
		}
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
		public global::WebOptimizer.UI.Entities.Task CreateTask(Sidvall.Data.DataRowState? dataRowState)
		{
			return new global::WebOptimizer.UI.Entities.Task(dataRowState);
		}
		
		#endregion
		#region CreateItems
		
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
		public global::WebOptimizer.UI.Entities.SourceCollection CreateSourceCollection()
		{
			return new global::WebOptimizer.UI.Entities.SourceCollection();
		}
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
		public global::WebOptimizer.UI.Entities.TaskCollection CreateTaskCollection()
		{
			return new global::WebOptimizer.UI.Entities.TaskCollection();
		}
		
		#endregion
		#region Add
		
		public void Add(System.Collections.Generic.IEnumerable<global::WebOptimizer.Data.ISource> items, global::WebOptimizer.Data.ISource item)
		{
			var listItem = item as global::WebOptimizer.UI.Entities.Source;
			if (listItem == null)
				return;
			var list1 = items as System.Collections.Generic.ICollection<global::WebOptimizer.UI.Entities.Source>;
			if (list1 != null)
				list1.Add(listItem);
		}
		public void Add(System.Collections.Generic.IEnumerable<global::WebOptimizer.Data.ITask> items, global::WebOptimizer.Data.ITask item)
		{
			var listItem = item as global::WebOptimizer.UI.Entities.Task;
			if (listItem == null)
				return;
			var list1 = items as System.Collections.Generic.ICollection<global::WebOptimizer.UI.Entities.Task>;
			if (list1 != null)
				list1.Add(listItem);
		}
		
		#endregion
		#region Clear
		
		public void Clear(System.Collections.Generic.IEnumerable<global::WebOptimizer.Data.ISource> items)
		{
			var list1 = items as System.Collections.Generic.ICollection<global::WebOptimizer.UI.Entities.Source>;
			if (list1 != null)
				list1.Clear();
		}
		public void Clear(System.Collections.Generic.IEnumerable<global::WebOptimizer.Data.ITask> items)
		{
			var list1 = items as System.Collections.Generic.ICollection<global::WebOptimizer.UI.Entities.Task>;
			if (list1 != null)
				list1.Clear();
		}
		
		#endregion
		#region Remove
		
		public void Remove(System.Collections.Generic.IEnumerable<global::WebOptimizer.Data.ISource> items, global::WebOptimizer.Data.ISource item)
		{
			var listItem = item as global::WebOptimizer.UI.Entities.Source;
			if (listItem == null)
				return;
			var list1 = items as System.Collections.Generic.ICollection<global::WebOptimizer.UI.Entities.Source>;
			if (list1 != null)
				list1.Remove(listItem);
		}
		public void Remove(System.Collections.Generic.IEnumerable<global::WebOptimizer.Data.ITask> items, global::WebOptimizer.Data.ITask item)
		{
			var listItem = item as global::WebOptimizer.UI.Entities.Task;
			if (listItem == null)
				return;
			var list1 = items as System.Collections.Generic.ICollection<global::WebOptimizer.UI.Entities.Task>;
			if (list1 != null)
				list1.Remove(listItem);
		}
		
		#endregion
		#region IResourceManager Members

		global::WebOptimizer.Data.ISource global::WebOptimizer.Data.Model.IResourceManager.CreateSource(Sidvall.Data.DataRowState? dataRowState)
		{
			return CreateSource(dataRowState);
		}
		global::WebOptimizer.Data.ITask global::WebOptimizer.Data.Model.IResourceManager.CreateTask(Sidvall.Data.DataRowState? dataRowState)
		{
			return CreateTask(dataRowState);
		}
		System.Collections.Generic.IEnumerable<global::WebOptimizer.Data.ISource> global::WebOptimizer.Data.Model.IResourceManager.CreateSourceCollection()
		{
			return CreateSourceCollection();
		}
		System.Collections.Generic.IEnumerable<global::WebOptimizer.Data.ITask> global::WebOptimizer.Data.Model.IResourceManager.CreateTaskCollection()
		{
			return CreateTaskCollection();
		}

		#endregion
		
		#region Current

		private static readonly System.Lazy<ResourceManager> _Current = new System.Lazy<ResourceManager>(() => new ResourceManager());
		public static ResourceManager Current
		{
			get
			{
				return _Current.Value;
			}
		}

		#endregion
	}
}